package com.qxgltj.qxgl.dao;

import java.util.List;

import com.qxgltj.qxgl.model.Roles;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

/**
 * IRolesDao
 */
public interface IRolesDao extends JpaRepository<Roles,String>,JpaSpecificationExecutor<Roles> {
    //查询用户已经存在的角色
    @Modifying
    @Transactional
    @Query(value = "select * from roles where id in( select role_id from role_users where user_id=?1)",nativeQuery = true)
    List<Roles> findRoles(String user_id);
    
}